<?php
defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$return=array();
if($_RQ['op']=='get'){
	$return['item']=$this->plugin_setting('setting');
	$return['item']['func1']="model('jy_douyin/set_data')->upnews($title,$content,$abstract,$save,$article_tag),$title 文章标题,$content 文章内容,$abstract 文章摘要,$save 0存草稿，1发布,$article_tag 文章分类名";
	$return['item']['func2']="cfc('jy_douyin')->video()";
	$return['item']['help_url']="https://www.douyin.com/";
	$return['item']['redirect_uri']=custom_url('jy_douyin/getauth/',true);
	$scope='video.create,user_info';
	$return['item']['authurl']='https://open.douyin.com/platform/oauth/connect?client_key='.$return['item']['client_key'].'&response_type=code&scope='.$scope.'&redirect_uri='.$return['item']['redirect_uri'];
	$return['htmls']=array (
		  'type' => 'edit',
		  'post' => 'post',
		  'edit_tab' => '参数设置',
		  'edits' =>array (
		    0 =>array(
		      'title' => '参数设置',
		      'list' => array (
				array ('name' => 'redirect_uri','type' => 'copy','title' => '用户授权登录成功后跳转的url','help'=>'如果有需要，可以复制！'),
				array ('name' => 'help_url','type' => 'copy','title' => '抖音号登录地址','help'=>'抖音暂时不支持第三方接口发布内容'),
				array ('name' => 'client_key','type' => 'string','title' => '抖音号client_key','help'=>'移步：https://open.douyin.com/ 创建应用'),
				array ('name' => 'client_secret','type' => 'string','title' => '抖音号的密钥'),
				array ('name' => 'authurl','type' => 'href_url','read'=>1,'title' =>'获取AccessToken','btntitle'=>'点击授权','help'=>'上面抖音号参数只有保存后，这里的授权地址才会更新！'),
		      ),
		    ),
		  ),
	);
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();	
	$this->plugin_setting('setting',$postdata);
	exi('设置成功！');
}
?>